import sys
import os
from PyQt5.QtWidgets import QApplication
from gui.main_window import MainWindow

if __name__ == "__main__":
    # 设置当前工作目录（解决资源路径问题）
    os.chdir(os.path.dirname(os.path.abspath(__file__)))
    
    # 检查必要依赖
    try:
        from PyQt5.QtCore import Qt
        from PyQt5.QtWidgets import QApplication
        from serial import Serial
        from OpenGL.GL import glClear
    except ImportError as e:
        print(f"缺少必要依赖: {e}")
        print("请运行: pip install PyQt5 pyserial PyOpenGL")
        sys.exit(1)
    
    app = QApplication(sys.argv)
    app.setStyle('Fusion')  # 统一界面风格
    
    window = MainWindow()
    window.show()
    
    sys.exit(app.exec_())